package com.mvvm.store.ui.delivery.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;

import com.lihang.nbadapter.BaseAdapter;
import com.mvvm.store.R;
import com.mvvm.store.base.BaseViewHolder;
import com.mvvm.store.bean.basebean.DeliveryInfoBean;
import com.mvvm.store.databinding.ItemDeliveryInfoBinding;

public class DeliveryInfoAdapter extends BaseAdapter<DeliveryInfoBean> {

    @Override
    public RecyclerView.ViewHolder getViewHolder(ViewGroup viewGroup, int viewType) {
        ItemDeliveryInfoBinding itemDeliveryInfoBinding= DataBindingUtil.inflate(LayoutInflater.from(viewGroup.getContext()), R.layout.item_delivery_info, viewGroup, false);
        return new BaseViewHolder(itemDeliveryInfoBinding);
    }

    @Override
    public void onBindMyViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
        BaseViewHolder baseViewHolder = (BaseViewHolder) viewHolder;
        ItemDeliveryInfoBinding itemDeliveryInfoBinding=(ItemDeliveryInfoBinding) baseViewHolder.binding;
        DeliveryInfoBean deliveryInfoBean=dataList.get(i);
        itemDeliveryInfoBinding.tvOddNumber.setText(deliveryInfoBean.getOddNumber()+"");

        itemDeliveryInfoBinding.tvMaterialSnpNumber.setText(deliveryInfoBean.getSumNumber()+"");

        itemDeliveryInfoBinding.tvSumNumber.setText(deliveryInfoBean.getRealToNumber()+"");

        itemDeliveryInfoBinding.tvPackNumber.setText(deliveryInfoBean.getPackNumber()+"");

        itemDeliveryInfoBinding.tvLableNumber.setText(deliveryInfoBean.getRealToPack()+"");

        if(deliveryInfoBean.getSumNumber()==deliveryInfoBean.getRealToNumber()){
            itemDeliveryInfoBinding.ivFinishOrder.setVisibility(View.VISIBLE);
        }else {
            itemDeliveryInfoBinding.ivFinishOrder.setVisibility(View.GONE);
        }

    }
}
